import {Request, Response} from 'express'
import Log4js from '../../../core/log/Log4jsConfig'
import {BaseController} from "../../../core/base/BaseController"
import {Controller} from "../../../core/decorator/Controller";
import {RequestMapping, RequetMethod} from "../../../core/decorator/RequestMapping";
import {R} from "../../../core/domain/R";

const logger = Log4js.getLogger('ActionGroupController')

@Controller('/action/group')
export class ActionGroupController extends BaseController {

    @RequestMapping("/list", RequetMethod.GET)
    list(req: Request, res: Response) {
        logger.info('list')
        res.json(R.ok([{
            id: 1001,
            name: 'sys'
        }, {
            id: 1002,
            name: 'user'
        }]))
    }

    @RequestMapping("/list", RequetMethod.POST)
    add(req: Request, res: Response) {
        logger.info('add')
        console.log(req.body)
        res.json(R.ok([{
            id: 1001,
            name: 'sys'
        }, {
            id: 1002,
            name: 'user'
        }]))
    }
}
